#pragma once
#include <iostream>
#include <vector>
#include <unordered_map>
#include <fstream>
#include <sstream>
#include <print>

#include <nlohmann/json.hpp>

struct Serialnfo {
    std::string portName;
    int baudRate;
    int parity;     // 0-none, 1-even, 2-odd
    int dataBits;   // 5,6,7,8
    int stopBits;   // 1,2
    bool enable;
    std::string url;
};

struct LoadFile
{
    std::string save_file;
    std::string port_file;
    std::string timeout_file;
    int timeout_seconds;

    void parse_save_file(const std::string& path);

    void parse_port_file(const std::string& json_path);

    void parse_timeout_file(const std::string& path);

    std::unordered_map<std::string, Serialnfo> serials;
};

